﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SIAKADCORE.Models
{
    /// <summary>
    /// Kelas User [dbo].[user]
    /// </summary>
    public class User
    {
        #region Constants
        /// <summary>
        /// Konstanta panjang id dari primary key
        /// </summary>
        public const int IdLength = 10;
        /// <summary>
        /// Konstanta prefix dari primary key
        /// </summary>
        public const string IdPrefix = "USR";
        /// <summary>
        /// Konstanta nama tabel pada database
        /// </summary>
        public const string TableName = "[dbo].[user]";
        /// <summary>
        /// Konstanta nama kolom idUser pada tabel
        /// </summary>
        public const string ColumnNameIdUser = "[id_user]";
        /// <summary>
        /// Konstanta nama kolom username pada tabel
        /// </summary>
        public const string ColumnNameUsername = "[username]";
        /// <summary>
        /// Konstanta nama kolom password pada tabel
        /// </summary>
        public const string ColumnNamePassword = "[password]";
        /// <summary>
        /// Konstanta nama kolom idRole pada tabel
        /// </summary>
        public const string ColumnNameIdRole = "[id_role]";
        /// <summary>
        /// Konstanta nama kolom idDosen pada tabel
        /// </summary>
        public const string ColumnNameIdDosen = "[id_dosen]";
        /// <summary>
        /// Konstanta nama kolom idMahasiswa pada tabel
        /// </summary>
        public const string ColumnNameIdMahasiswa = "[id_mahasiswa]";
        /// <summary>
        /// Konstanta nama kolom idPegawai pada tabel
        /// </summary>
        public const string ColumnNameIdPegawai = "[id_pegawai]";
        #endregion

        #region Fields
        /// <summary>
        /// [id_user] CHAR(10) PRIMARY KEY
        /// </summary>
        private string idUser;
        /// <summary>
        /// [username] VARCHAR(20) NOT NULL
        /// </summary>
        private string username;
        /// <summary>
        /// [password] VARCHAR(10) NOT NULL
        /// </summary>
        private string password;
        /// <summary>
        /// [id_role] CHAR(5) NOT NULL
        /// </summary>
        private string idRole;
        /// <summary>
        /// [id_dosen] CHAR(10) NULL
        /// </summary>
        private string idDosen;
        /// <summary>
        /// [id_mahasiswa] CHAR(10) NULL
        /// </summary>
        private string idMahasiswa;
        /// <summary>
        /// [id_pegawai] CHAR(10) NULL
        /// </summary>
        private string idPegawai;
        #endregion

        #region Properties
        /// <summary>
        /// [id_user] CHAR(10) PRIMARY KEY
        /// </summary>
        public string IdUser
        {
            get { return this.idUser; }
            set { this.idUser = value; }
        }

        /// <summary>
        /// [username] VARCHAR(20) NOT NULL
        /// </summary>
        public string Username
        {
            get { return this.username; }
            set { this.username = value; }
        }

        /// <summary>
        /// [password] VARCHAR(10) NOT NULL
        /// </summary>
        public string Password
        {
            get { return this.password; }
            set { this.password = value; }
        }

        /// <summary>
        /// [password] VARCHAR(10) NOT NULL
        /// </summary>
        public string IdRole
        {
            get { return this.idRole; }
            set { this.idRole = value; }
        }

        /// <summary>
        /// [id_dosen] CHAR(10) NULL
        /// </summary>
        public string IdDosen
        {
            get { return this.idDosen; }
            set { this.idDosen = value; }
        }

        /// <summary>
        /// [id_mahasiswa] CHAR(10) NULL
        /// </summary>
        public string IdMahasiswa
        {
            get { return this.idMahasiswa; }
            set { this.idMahasiswa = value; }
        }

        /// <summary>
        /// [id_pegawai] CHAR(10) NULL
        /// </summary>
        public string IdPegawai
        {
            get { return this.idPegawai; }
            set { this.idPegawai = value; }
        }
        #endregion

        #region Constructors
        /// <summary>
        /// Konstruktor
        /// </summary>
        public User()
        {

        }

        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="idUser">[id_user] CHAR(10) PRIMARY KEY</param>
        /// <param name="username">[username] VARCHAR(20) NOT NULL</param>
        /// <param name="password">[password] VARCHAR(10) NOT NULL</param>
        /// <param name="idRole">[password] VARCHAR(10) NOT NULL</param>
        /// <param name="idDosen">[id_dosen] CHAR(10) NULL</param>
        /// <param name="idMahasiswa">[id_mahasiswa] CHAR(10) NULL</param>
        /// <param name="idPegawai">[id_pegawai] CHAR(10) NULL</param>
        public User(string idUser, string username, string password, string idRole, string idDosen, string idMahasiswa, string idPegawai)
        {
            this.idUser = idUser;
            this.username = username;
            this.password = password;
            this.idRole = idRole;
            this.idDosen = idDosen;
            this.idMahasiswa = idMahasiswa;
            this.idPegawai = idPegawai;
        }
        #endregion

        public override string ToString()
        {
            return string.Format("ID_USER: {0} | USERNAME: {1} | PASSWORD: {2} | ID_ROLE: {3} | ID_DOSEN: {4} | ID_MAHASISWA: {5} | ID_PEGAWAI {6}", this.idUser, this.username, this.password, this.idRole, this.idDosen, this.idMahasiswa, this.idPegawai);
        }
    }
}
